//package com.hnfnu.service;
//
//import com.hnfnu.constant.DonationContractConstants;
//import com.hnfnu.protocol.model.bo.DonationRecordAddRecordInputBO;
//import com.hnfnu.protocol.model.bo.DonationRecordGetRecordsByProjectIdInputBO;
//import com.hnfnu.protocol.model.bo.DonationRecordRecordsInputBO;
//import lombok.Data;
//import lombok.NoArgsConstructor;
//import org.fisco.bcos.sdk.v3.client.Client;
//import org.fisco.bcos.sdk.v3.transaction.manager.AssembleTransactionProcessor;
//import org.fisco.bcos.sdk.v3.transaction.manager.TransactionProcessorFactory;
//import org.fisco.bcos.sdk.v3.transaction.model.dto.CallResponse;
//import org.fisco.bcos.sdk.v3.transaction.model.dto.TransactionResponse;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.PostConstruct;
//import java.util.Arrays;
//
//@Service
//@NoArgsConstructor
//@Data
//public class DonationRecordService {
//  @Value("${contract.donationRecordAddress}")
//  private String address;
//
//  @Autowired
//  private Client client;
//
//  AssembleTransactionProcessor txProcessor;
//
//  @PostConstruct
//  public void init() throws Exception {
//    this.txProcessor = TransactionProcessorFactory.createAssembleTransactionProcessor(this.client, this.client.getCryptoSuite().getCryptoKeyPair());
//  }
//
//  public CallResponse lastBlockId() throws Exception {
//    return this.txProcessor.sendCall(this.client.getCryptoSuite().getCryptoKeyPair().getAddress(), this.address, DonationContractConstants.DonationRecordAbi, "lastBlockId", Arrays.asList());
//  }
//
//  public CallResponse getRecordsByProjectId(DonationRecordGetRecordsByProjectIdInputBO input) throws
//      Exception {
//    return this.txProcessor.sendCall(this.client.getCryptoSuite().getCryptoKeyPair().getAddress(), this.address, DonationContractConstants.DonationRecordAbi, "getRecordsByProjectId", input.toArgs());
//  }
//
//  public TransactionResponse addRecord(DonationRecordAddRecordInputBO input) throws Exception {
//    return this.txProcessor.sendTransactionAndGetResponse(this.address, DonationContractConstants.DonationRecordAbi, "addRecord", input.toArgs());
//  }
//
//  public CallResponse records(DonationRecordRecordsInputBO input) throws Exception {
//    return this.txProcessor.sendCall(this.client.getCryptoSuite().getCryptoKeyPair().getAddress(), this.address, DonationContractConstants.DonationRecordAbi, "records", input.toArgs());
//  }
//}
